package courseManagebl;
import java.rmi.RemoteException;
import java.util.ArrayList;

import message.Message;

import courseManageblService.*;
import PO.CoursePO;
import VO.CourseVO;
import VO.UserVO;
public class CourseManageController implements CourseManageblService{

	@Override
	public Message publishCourse(CourseVO course) {
		
		CourseManage cm=new CourseManage();
		Message message=null;
		try {
			message = cm.publishCourse(course);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
			return message;
		
	}

	@Override
	public Message complete_class_inform(CourseVO course) {
		CourseManage cm=new CourseManage();
		Message message=null;
		try {
			message =cm.complete_class_inform(course);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return message;
	}

	@Override
	public ArrayList<CourseVO> showCourse(UserVO uservo){
		CourseManage cm=new CourseManage();
		ArrayList<CourseVO> voList=new ArrayList<CourseVO>();
		try {
			voList= cm.showCourse(uservo);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return voList;
	}

	@Override
	public Message comment(CourseVO courseVO, int comment){
		//initialization
		CourseManage cm=new CourseManage();
		Message message=null;
		try {
			message =cm.comment(courseVO,comment);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return message;
		//call function
		
	}

	@Override
	public ArrayList<String> CountBydp() {
		CourseManage cm=new CourseManage();
		ArrayList<String> countList=new ArrayList<String>();
		try {
			countList =cm.CountBydp();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return countList;
		//call function
	}

	

	@Override
	public ArrayList<CourseVO> showCourse(String requirement) {
		CourseManage cm=new CourseManage();
		ArrayList<CourseVO> voList=new ArrayList<CourseVO>();
		try {
			voList= cm.showCourse(requirement);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return voList;
	}

	@Override
	public ArrayList<CourseVO> showCourseByDepart(String depart) {
		CourseManage cm=new CourseManage();
		ArrayList<CourseVO> voList=new ArrayList<CourseVO>();
		try {
			voList= cm.showCourseByDepart(depart);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return voList;
	}

}
